<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use Laravel\Lumen\Routing\Controller as BaseController;

class Controller extends BaseController
{
    public function getOne(){
        $count = DB::collection('mottos')->count();
        $skip=random_int(0, $count-1);
        $oneItem = DB::collection('mottos')->skip($skip)->first();
        return response()->json(['data'=>$oneItem]);
    }
}
